#pragma once

#include "Entity.h"
#include "EventHandler.h"
#include "TinyXML2.h"
#include "IUpdatable.h"

class IEntityController : public IUpdatable
{
public:
	typedef std::vector<Pointer<IEntityController>> Vector_t;

	IEntityController( Entity* entity );
	virtual ~IEntityController() {};
	
	virtual void ToXML( tinyxml2::XMLPrinter& printer ) = 0;
	virtual const HashedString& Type() = 0;
	
	bool ReceiveEvent( IEvent& event );
	void RegisterHandler(const HashedString& eventType, Pointer<EventHandler> handler);
	void RemoveHandler(const HashedString& eventType, void* handler);
	
	EventHandler::Map_t& getEventHandlers();

	Entity* getEntity();
protected:
	Entity* m_entity;
	EventHandler::Map_t m_eventHandlers;
};